package com.he.yiliao.adapter;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.he.yiliao.R;
import com.he.yiliao.bean.wenxian;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class listad extends ArrayAdapter<wenxian> {
    public listad(@NonNull Context context, int resource, @NonNull List<wenxian> objects) {
        super(context, resource, objects);
    }
    //每个子项被滚动到屏幕内的时候会被调用
    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        wenxian wenxian=getItem(position);//得到当前项的 Fruit 实例
        //为每一个子项加载设定的布局
        View view=LayoutInflater.from(getContext()).inflate(R.layout.wenxain,parent,false);
        //分别获取 image view 和 textview 的实例
      //  TextView fruitname =view.findViewById(R.id.wen);
        TextView fruitprice=view.findViewById(R.id.di);
        // 设置要显示的图片和文字
       // fruitname.setText(wenxian.getWen());
        fruitprice.setText(wenxian.getDi());
        return view;
    }
}


